/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package pvt.delez.pam.virgin.impl;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

import pvt.delez.pam.virgin.*;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class VirginFactoryImpl extends EFactoryImpl implements VirginFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static VirginFactory init() {
		try {
			VirginFactory theVirginFactory = (VirginFactory)EPackage.Registry.INSTANCE.getEFactory(VirginPackage.eNS_URI);
			if (theVirginFactory != null) {
				return theVirginFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new VirginFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public VirginFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case VirginPackage.PROJECT_DESCRIPTOR: return createProjectDescriptor();
			case VirginPackage.CLASS_PATH_DESCRIPTOR: return createClassPathDescriptor();
			case VirginPackage.BUILD_COMMAND: return createBuildCommand();
			case VirginPackage.CLASS_PATH_ENTRY: return createClassPathEntry();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case VirginPackage.CLASS_PATH_ENTRY_KIND:
				return createClassPathEntryKindFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case VirginPackage.CLASS_PATH_ENTRY_KIND:
				return convertClassPathEntryKindToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ProjectDescriptor createProjectDescriptor() {
		ProjectDescriptorImpl projectDescriptor = new ProjectDescriptorImpl();
		return projectDescriptor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ClassPathDescriptor createClassPathDescriptor() {
		ClassPathDescriptorImpl classPathDescriptor = new ClassPathDescriptorImpl();
		return classPathDescriptor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BuildCommand createBuildCommand() {
		BuildCommandImpl buildCommand = new BuildCommandImpl();
		return buildCommand;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ClassPathEntry createClassPathEntry() {
		ClassPathEntryImpl classPathEntry = new ClassPathEntryImpl();
		return classPathEntry;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ClassPathEntryKind createClassPathEntryKindFromString(EDataType eDataType, String initialValue) {
		ClassPathEntryKind result = ClassPathEntryKind.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertClassPathEntryKindToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public VirginPackage getVirginPackage() {
		return (VirginPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static VirginPackage getPackage() {
		return VirginPackage.eINSTANCE;
	}

} //VirginFactoryImpl
